﻿<Application x:Class="WpfStyles.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:local="clr-namespace:WpfStyles"
             StartupUri="MainWindow.xaml">
    <Application.Resources>
        <Style x:Key ="BasicControlStyle" TargetType="Control">
            <Setter Property = "Control.FontSize" Value ="14"/>
            <Setter Property = "Control.Height" Value = "40"/>
            <Setter Property = "Control.Cursor" Value = "Hand"/>
        </Style>
        <Style x:Key ="BigGreenButton" TargetType="Button">
            <Setter Property = "FontSize" Value ="20"/>
            <Setter Property = "Height" Value = "100"/>
            <Setter Property = "Width" Value = "100"/>
            <Setter Property = "Background" Value = "DarkGreen"/>
            <Setter Property = "Foreground" Value = "Yellow"/>
        </Style>
        <!-- The default style for all text boxes. -->
        <Style TargetType="TextBox">
            <Setter Property = "FontSize" Value ="14"/>
            <Setter Property = "Width" Value = "100"/>
            <Setter Property = "Height" Value = "30"/>
            <Setter Property = "BorderThickness" Value = "5"/>
            <Setter Property = "BorderBrush" Value = "Red"/>
            <Setter Property = "FontStyle" Value = "Italic"/>
            <!-- The following setter will be applied only when the text box is in focus. -->
            <!--<Style.Triggers>
                <Trigger Property = "IsFocused" Value = "True">
                    <Setter Property = "Background" Value = "Yellow"/>
                </Trigger>
            </Style.Triggers>-->
            <!-- The following setter will be applied only when the text box is
  in focus AND the mouse is over the text box. -->
            <Style.Triggers>
                <MultiTrigger>
                    <MultiTrigger.Conditions>
                        <Condition Property = "IsFocused" Value = "True"/>
                        <Condition Property = "IsMouseOver" Value = "True"/>
                    </MultiTrigger.Conditions>
                    <Setter Property = "Background" Value = "Yellow"/>
                </MultiTrigger>
            </Style.Triggers>
        </Style>
        <!-- This style is based on BigGreenButton. -->
        <Style x:Key ="TiltButton" TargetType="Button" BasedOn = "{StaticResource BigGreenButton}">
            <Setter Property = "Foreground" Value = "White"/>
            <Setter Property = "RenderTransform">
                <Setter.Value>
                    <RotateTransform Angle = "20"/>
                </Setter.Value>
            </Setter>
        </Style>
        <!-- The growing button style! -->
        <Style x:Key = "GrowingButtonStyle" TargetType="Button">
            <Setter Property = "Height" Value = "40"/>
            <Setter Property = "Width" Value = "100"/>
            <Style.Triggers>
                <Trigger Property = "IsMouseOver" Value = "True">
                    <Trigger.EnterActions>
                        <BeginStoryboard>
                            <Storyboard TargetProperty = "Height">
                                <DoubleAnimation From = "40" To = "200"
                                                 Duration = "0:0:2" AutoReverse="True"/>
                            </Storyboard>
                        </BeginStoryboard>
                    </Trigger.EnterActions>
                </Trigger>
            </Style.Triggers>
        </Style>
    </Application.Resources>
</Application>
